package zxh.com.until;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

public class DateUtil {
    public DateUtil() {
    }

    public static String getNowTime() {
        String strDateTime = null;
        SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
        strDateTime = formater.format(new Date());
        return strDateTime;
    }

    public static String getNowTime2() {
        String strDateTime = null;
        SimpleDateFormat formater = new SimpleDateFormat("yyyyMMdd");
        strDateTime = formater.format(new Date());
        return strDateTime;
    }

    public static String DateToString(Date date, String pattern) {
        String strDateTime = null;
        return strDateTime;
    }

    public static String DateTimeToString(Date date) {
        String _pattern = "yyyy-MM-dd HH:mm:ss";
        return date == null ? null : DateToString(date, _pattern);
    }

    public static Date StringToDate(String str) {
        String _pattern = "yyyy-MM-dd";
        return StringToDate(str, _pattern);
    }

    public static Date StringToDateTime(String str) {
        String _pattern = "yyyy-MM-dd HH:mm:ss";
        return StringToDate(str, _pattern);
    }
    
    public static long dateToStamp(String ts) throws Exception {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = simpleDateFormat.parse(ts);
        return date.getTime();
    }
    public static Date StringToDate(String str, String pattern) {
        Date dateTime = null;
        return dateTime;
    }
}
